<!-- INCLUDE overall_header.html -->

<!--
 @package RCB - R/C Booking
 @version $Id$
 @copyright (c) 2008 Scott Deakin
 @license http://opensource.org/licenses/gpl-license.php GNU Public License
-->

<script LANGUAGE="javascript">


    function hide(id)
	{
		id.style.display = "none";
	}

	function show(id)
	{
		id.style.display = "";
	}

	function numbersOnly(id, e, dec)
	{
		var key;
		var keychar;

		if (window.event)
		{
			key = window.event.keyCode;
		}
		else if (e)
		{
			key = e.which;
		}
		else
		{
			return true;
		}

		keychar = String.fromCharCode(key);

		if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
		{
			return true;
		}
		else if ((("0123456789").indexOf(keychar) > -1))
		{ 
			return true;
		}
		else if (dec && (keychar == "."))
		{
			id.form.elements[dec].focus();
			return false;
		}
		else
		{
			return false;
		}
	}

	function validName(id)
	{
		if(!document.getElementById)
		{
			return true;
		}
		var msg = document.getElementById("ValidNameMsg");

		if(id.value.length <= 0) 
		{
			show(msg);	
			return false;
		}
		else
		{
			hide(msg);
			return true;
		}
	}

	function validPt(ptIndex) 
	{
		if(!document.getElementById)
		{
			return true;
		}
		var id = document.getElementById("pt[" + ptIndex + "]");
		var msg = document.getElementById("ValidPtMsg[" + ptIndex + "]");	
		if( (id.value.length > 0) && (id.value.length < 7) )
		{
			show(msg);
			return(false);
		}
		else
		{
			hide(msg);
			return(true);
		}
	}

</script>

<form id="book" method="post" action="book.php">
<div class="panel bg3">

	<div class="inner"><span class="corners-top"><span></span></span>

	<h2>Driver Details</h2>

	<div id="cp-main" class="ucp-main">

		<div class="panel">
			<div class="inner"><span class="corners-top"><span></span></span>

			
			<fieldset>
				<dl>
					<dt><label for="name">{L_RCB_DRIVER_NAME}</label><br />
						<span>{L_RCB_DRIVER_NAME_HELP}</span></dt>
					<dd>
						<input type="text" name="name" id="name" size="20" 
						maxlength="20" value="{RCB_NAME}"
						class="inputbox autowidth" title="Driver Name" 
						onBlur="validName(this)"/>
						<span id="ValidNameMsg">
							<font color="red">{L_RCB_INVALID_NAME}</font>
							{L_RCB_INVALID_NAME_HELP}
						</span>
					</dd>
	
				</dl>
				<dl>
					<dt><label for="BRCA">{L_RCB_BRCA_NUMBER}:</label></dt>
					<dd><input type="text" name="brca" id="brca" size="8" 
						maxlength="8" value="{RCB_BRCA}" 
						class="inputbox autowidth" title="BRCA Number" 
						onKeyPress="return numbersOnly(this, event);"/></dd>
				</dl>
				</fieldset>
			<span class="corners-bottom"><span></span></span></div>

		</div>
	</div>
	<span class="corners-bottom"><span></span></span></div>
</div>
<div class="panel bg3">
	<div class="inner"><span class="corners-top"><span></span></span>
	<h2>{L_RCB_BRCA_NUMBER}</h2>
	<div id="cp-main" class="ucp-main">

		<div class="panel">
			<div class="inner"><span class="corners-top"><span></span></span>
				 <table class="table1" cellspacing="1" id="meetinglist">
            		<thead>
                		<tr>
                    		<th>{L_RCB_CLASS}</th>
							<th>{L_RCB_CAR}</th>
                    		<th>{L_RCB_PT}</th>
                    		<th colspan=4>{L_RCB_FREQ}</th>
							<th>{L_RCB_BOOKED}</th>
                		</tr>
   	        		</thead>
					<tbody>
					<!-- BEGIN classrow -->
                		<tr class="bg1">
                    		<td><input type="hidden" name="class_id[{classrow.S_ROW_COUNT}]" 
										id="class_id[{classrow.S_ROW_COUNT}]" 
										value="{classrow.CLASS_ID}"  />{classrow.DESCRIPTION}</td>
                    		<td><input type="text" name="car[{classrow.S_ROW_COUNT}]" 
										id="car[{classrow.S_ROW_COUNT}]" 
										value="{classrow.CAR}"></td>
                    		<td><input type="text" name="pt[{classrow.S_ROW_COUNT}]" 
										id="pt[{classrow.S_ROW_COUNT}]" 
										value="{classrow.PT}"
										size="7" maxlength="7"
										onBlur="validPt({classrow.S_ROW_COUNT})"
										onKeyPress="numbersOnly(this, event)"/>
								<span id="ValidPtMsg[{classrow.S_ROW_COUNT}]">
									<font color="red">
										Invalid PT
									</font>
									<p>PT Must either be blank or 7 digits</p>
								</span>
							</td>
							<!-- BEGIN freq_id -->
                    		<td>
								<select name="freq[{classrow.S_ROW_COUNT}][{classrow.freq_id.S_ROW_COUNT}]">
									<option/>
									<!-- BEGIN validfreq -->
										<option {classrow.freq_id.validfreq.S_SELECTED}>
											{classrow.freq_id.validfreq.FREQ}</option>
									<!-- END validfreq -->
								</select>
							</td>
							<!-- END freq_id -->
                    		<td><input type="checkbox" name="booked[{classrow.S_ROW_COUNT}]" 
									{classrow.S_CHECKED}></td>
                		</tr>
					<!-- BEGINELSE -->
						<tr class="bg1">
							<td colspan="4">No Classes</td>
						</tr>
					<!-- END classrow -->
					</tbody>
				</table>
			<span class="corners-bottom"><span></span></span></div>
		</div>
	</div>
	<span class="corners-bottom"><span></span></span></div>
</div>
<div class="panel bg3">
	<div class="inner"><span class="corners-top"><span></span></span>

		<fieldset class="submit-buttons">
			<input type="reset" value="Reset" name="reset" class="button2" />&nbsp; 
			<input type="submit" name="submit" value="Cancel" class="button1" />
			<input type="submit" name="submit" value="Submit" class="button1" />
			<input type="hidden" name="meeting_id" value="{MEETING_ID}" />
		</fieldset>
	<span class="corners-bottom"><span></span></span></div>
</div>

</form>

<script LANGUAGE="javascript">
	// do some initial sanity checks
	if(document.getElementById) 
	{
		validName(document.getElementById("name"));
		for(var i = 0; i < {CLASS_COUNT}; i++) 
		{
			validPt(i);
		}
	}
</script>

<!-- INCLUDE overall_footer.html -->

